import React from "react";
import { HashRouter as Router, Routes, Route } from "react-router-dom";
import Home from "./views/Home";
import About from "./views/About";
import User from "./views/User";
import List from "./views/List";
import { useSelector } from "react-redux";

export default function App() {
  let flag = useSelector((state) => state.flagInfo.flag);
  return (
    <div>
      <div style={{ display: flag ? "block" : "none" }}>
        <a href="#/">首页</a>|<a href="#/about">关于</a>|
        <a href="#/user">用户</a>|
        <a href="#/list">列表</a>
      </div>
      <Router>
        <Routes>
          <Route path="/" element={<Home></Home>} exact></Route>
          <Route path="/about" element={<About></About>}></Route>
          <Route path="/user" element={<User></User>}></Route>
          <Route path="/list" element={<List></List>}></Route>
        </Routes>
      </Router>
    </div>
  );
}
